﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<TopicEntity>>" %>
<%if (Model != null && Model.Count>0)
  {%>
<div class="fr-widget white-space">
    <div class="header">
        <div class="icon">
        </div>
        <span>Kết quả tìm kiếm </span>
    </div>
    <table cellpadding="0" cellspacing="1" width="100%">
        <tr>
            <td class="table-header width5">
                &nbsp;
            </td>
            <td class="table-header">
                Chủ đề
            </td>
            <td class="table-header width20">
                Bài viết cuối
            </td>
            <td class="table-header width10">
                Trả lời
            </td>
            <td class="table-header width10">
                Lượt xem
            </td>
            <td class="table-header width25">
                Diễn đàn
            </td>
        </tr>
        <%

       

           var _topics = Model.Skip(ForumContext.PageIndex-1 * ForumContext.Configuration.TopicsPerPage).Take(ForumContext.Configuration.TopicsPerPage).ToList();

           foreach (var topic in _topics)
            {
                
                
        %>
        <tr>
            <td class="table-cell table-cell-height">
                <div class="topic-icon topic-not-new">
                    &nbsp;</div>
            </td>
            <td class="table-cell-alter">
                <% if (!string.IsNullOrEmpty(topic.Icon))
                   {%>
                <img src="<%=ForumContext.Configuration.TopicSmiles+topic.Icon %>" alt="<%=topic.Icon %>"
                    class="smile" />
                <%
                    }%>
                <a class="fr-subject" href="<%=ForumContext.ThreadLink(topic.TopicId, topic.TopicName, null)%>"
                    title="<%=Html.Encode(topic.TopicName)%>">
                    <%=Html.Encode(topic.TopicName)%></a><br />
                <%=string.Format(ForumContext.GetGlobalText("POSTER"), topic.UserName, ForumContext.GetAbsoluteUrl(ForumUrls.USER_INFO, topic.UserName))%>
            </td>
            <td class="table-cell">
                <% if (!topic.LastPostId.HasValue || topic.LastPostId.Value == 0)
                   {%>
                <a title="<%=ForumContext.GetText("Topics", "VIEW_LAST_POST") %>" href="<%=ForumContext.GetAbsoluteUrl(ForumUrls.FIND_POST,topic.TopicId)  %>/"
                    class="last-post"><span class="post-date">
                        <%=ForumContext.PrettyDate(topic.Created)%></span></a><br />
                <%=string.Format(ForumContext.GetGlobalText("POSTER"), topic.UserName, ForumContext.GetAbsoluteUrl(ForumUrls.USER_INFO, topic.UserName))%>
                <%
                    }

                   else
                   {
                %>
                <a title="<%=ForumContext.GetText("Topics", "VIEW_LAST_POST") %>" href="<%=ForumContext.GetAbsoluteUrl(ForumUrls.FIND_POST,topic.LastPostId)  %>/"
                    class="last-post"><span class="post-date">
                        <%=ForumContext.PrettyDate(topic.LastPosted)%></span></a><br />
                <%=string.Format(ForumContext.GetGlobalText("POSTER"), topic.LastUserName, ForumContext.GetAbsoluteUrl(ForumUrls.USER_INFO, topic.LastUserName))%>
                <%
                    }
                %>
            </td>
            <td class="table-cell-alter center">
                <%=topic.TotalReplies%>
            </td>
            <td class="table-cell center">
                <%=topic.TotalViews%>
            </td>
            <td class="table-cell-alter">
                <a class="fr-subject" title="<%=Html.Encode(topic.ForumName)%>" href="<%=ForumContext.ForumLink(topic.ForumId, topic.ForumName, null)%>">
                    <%=Html.Encode(topic.ForumName)%></a>
            </td>
        </tr>
        <%
                
}
      
        %>
    </table>
</div>
<%}

  else
  {
      
%>
<div class="message-box white-space">
    Không tìm thấy kết quả nào
</div>
<%} %>
